<!-- 单表配置项（饼图） -->
<template>
  <el-form :inline="true" :model="form">
    <el-form-item label="显示数据标识">
      <el-switch v-model="form.series[0].label!.show" />
    </el-form-item>
    <el-form-item label="显示数据引导线">
      <el-switch v-model="form.series[0].labelLine!.show" />
    </el-form-item>
    <el-form-item label="图表尺寸-内径">
      <el-input v-model="form.series[0]!.radius[0]" />
    </el-form-item>
    <el-form-item label="图表尺寸-外径">
      <el-input v-model="form.series[0]!.radius[1]" />
    </el-form-item>
  </el-form>
</template>

<script lang="ts" setup>
import { chartStore } from '../../store/index'

import { Series } from '../../types/EChartsCommonConfig'
import { EChartsConfigForm } from '../../types/EChartsConfigForm'
import { chartDefaultConfig } from '../../types/EChartsTypes'

const store: any = chartStore()
const emits = defineEmits(['addSeries', 'removeSeries'])

let form: EChartsConfigForm = store.form

// 添加图表单独配置项
function addSeries() {
  const seriesItem: Series = chartDefaultConfig().PIE().series[0]
  emits('addSeries', seriesItem)
}

// 移除图表单独配置项
function removeSeries(id: number) {
  emits('removeSeries', id)
}
</script>

<style lang="less" scoped>
.series-item {
  background-color: #f6f6f6;
  border-radius: 5px;
  box-sizing: border-box;
  padding: 15px 20px 0 20px;
  margin: 10px 0;
}

.el-divider--horizontal {
  margin: 10px 0;
}
</style>
